<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use common\consts\Consts;
use common\business\EhrHelper;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;

/* @var $this yii\web\View */
/* @var $model common\models\kingdee\Person */
/* @var $employee \common\models\Employee */
/* @var $qywx_user \common\models\qywx\QywxUser */
/* @var $imageData string */
/* @var $kdSyncStatus boolean */
/* @var $employeeSyncStatus boolean */
/* @var $qywxSyncStatus boolean */
/* @var $kdSyncStatusStr string */
/* @var $employeeSyncStatusStr string */
/* @var $qywxSyncStatusStr string */

$this->title = Yii::t('app', 'Employee Details');
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Employee'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>

<div class="person-view">
    <p>
        <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->FID], ['class' => 'btn btn-primary']) ?>
        <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->FID], [
            'class' => 'btn btn-danger',
            'data' => [
                'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
                'method' => 'post',
            ],
        ]) ?>
        <?= Html::a(Yii::t('app', 'Sync Employee To Qywx'), ['sync-to-qywx', 'id' => $model->FID], ['class' => 'btn btn-primary', 'target' => '_blank']) ?>
        <?= Html::a(Yii::t('app', 'Return To List'), ['index'], ['class' => 'btn btn-primary']) ?>
    </p>

    <div class="box box-widget widget-user">
        <!-- Add the bg color to the header using any of the bg-* classes -->
        <div class="widget-user-header bg-aqua-active">
            <h3 class="widget-user-username"><?= $employee->name ?></h3>
            <h5 class="widget-user-desc"><?= $employee->position_name ?></h5>
        </div>
        <div class="widget-user-image">
            <img class="img-circle" src="<?= $imageData ?>" alt="<?= Yii::t('app', 'User Avatar') ?>">
        </div>
        <div class="box-footer">
            <div class="row">
                <div class="col-sm-3 border-right">
                    <div class="description-block">
                        <h5 class="description-header"><?= Yii::t('app', 'Employee No') ?></h5>
                        <span class="description-text"><?= $employee->number ?></span>
                    </div>
                    <!-- /.description-block -->
                </div>
                <!-- /.col -->
                <div class="col-sm-3 border-right">
                    <div class="description-block">
                        <h5 class="description-header"><?= Yii::t('app', 'Owner Department') ?></h5>
                        <span class="description-text"><?= $employee->department_name ?></span>
                    </div>
                    <!-- /.description-block -->
                </div>
                <!-- /.col -->
                <div class="col-sm-3">
                    <div class="description-block">
                        <h5 class="description-header"><?= Yii::t('app', 'Diploma') ?></h5>
                        <span class="description-text"></span>
                    </div>
                    <!-- /.description-block -->
                </div>
                <!-- /.col -->
                <div class="col-sm-3">
                    <div class="description-block">
                        <h5 class="description-header"><?= Yii::t('app', 'Employee Work Relation') ?></h5>
                        <span class="description-text"></span>
                    </div>
                    <!-- /.description-block -->
                </div>
            </div>
            <!-- /.row -->
        </div>

        <div class="nav-tabs-custom">
            <ul class="nav nav-tabs">
                <li class="active"><a href="#tab_kd" data-toggle="tab">
                        金蝶详细信息&nbsp;&nbsp;&nbsp;
                        <div class="box-tools pull-right">
                            <span data-toggle="tooltip" title="" class="badge bg-<?= $kdSyncStatus ? 'green' : 'red'?>"><?= $kdSyncStatusStr ?></span>
                        </div>
                    </a></li>
                <li><a href="#tab_employee" data-toggle="tab">
                        详细信息&nbsp;&nbsp;&nbsp;
                        <div class="box-tools pull-right">
                            <span data-toggle="tooltip" title="" class="badge bg-<?= $employeeSyncStatus ? 'green' : 'red'?>"><?= $employeeSyncStatusStr ?></span>
                        </div>
                    </a></li>
                <li><a href="#tab_qywx" data-toggle="tab">
                        企业微信详细信息&nbsp;&nbsp;&nbsp;
                        <div class="box-tools pull-right">
                            <span data-toggle="tooltip" title="" class="badge bg-<?= $qywxSyncStatus ? 'green' : 'red'?>"><?= $qywxSyncStatusStr ?></span>
                        </div>
                    </a></li>
                <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        Dropdown <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li>
                        <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li>
                        <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li>
                        <li role="presentation" class="divider"></li>
                        <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li>
                    </ul>
                </li>
                <li class="pull-right"><a href="#" class="text-muted"><i class="fa fa-gear"></i></a></li>
            </ul>

            <div class="tab-content">
                <div class="tab-pane active" id="tab_kd">
                    <?php $form = ActiveForm::begin([
                        'action' => ['update'],
                        'method' => 'post',
//            "options" => ['class' => 'form-inline', 'id' => 'detail_form'],
                    ]); ?>
                    <form role="form">
                        <div class="box-body">
                            <div class="form-group">
                                <?= $form->field($model, 'FID')->textInput() ?>
                            </div>
                            <div class="form-group">
                                <?= $form->field($model, 'FNUMBER')->textInput() ?>
                            </div>
                            <div class="form-group">
                                <?= $form->field($model, 'FGENDER')->dropDownList(EhrHelper::getGender_map()) ?>
                            </div>
                            <div class="form-group">
                                <?= $form->field($model, 'FBIRTHDAY')->textInput() ?>
                            </div>
                            <div class="form-group">
                                <?= $form->field($model, 'FIDCARDNO')->textInput() ?>
                            </div>
                            <div class="form-group">
                                <?= $form->field($model, 'FIDCARDADDRESS')->textInput() ?>
                            </div>
                            <div class="form-group">
                                <?= $form->field($model, 'FHJADDRESS')->textInput() ?>
                            </div>
                            <div class="form-group">
                                <?= $form->field($model, 'FNATIVEPLACE_L2')->textInput() ?>
                            </div>
                            <div class="form-group">
                                <?= $form->field($model, 'FBLOODTYPE')->dropDownList(EhrHelper::getBloodType_map()) ?>
                            </div>
                            <div class="form-group">
                                <?= $form->field($model, 'FPOLITICALFACEID')->dropDownList(ArrayHelper::map(\common\models\kingdee\HrPolitical::find()->all(), 'FID', 'FNAME_L2')) ?>
                            </div>
                            <div class="form-group">
                                <?= $form->field($model, 'FWEDID')->dropDownList(ArrayHelper::map(\common\models\kingdee\HrWed::find()->all(), 'FID', 'FNAME_L2')) ?>
                            </div>
                            <div class="form-group">
                                <?= $form->field($model, 'FHEALTHID')->dropDownList(ArrayHelper::map(\common\models\kingdee\HrHealth::find()->all(), 'FID', 'FNAME_L2')) ?>
                            </div>
                            <div class="form-group">
                                <?= $form->field($model, 'FFOLKID')->dropDownList(ArrayHelper::map(\common\models\kingdee\HrFolk::find()->all(), 'FID', 'FNAME_L2')) ?>
                            </div>
                            <div class="form-group">
                                <?= $form->field($model, 'FNATIONALITYID')->dropDownList(ArrayHelper::map(\common\models\kingdee\Nationality::find()->all(), 'FID', 'FNAME_L2')) ?>
                            </div>
                            <div class="form-group">
                                <?= $form->field($model, 'FREGRESIDENCEID')->dropDownList(ArrayHelper::map(\common\models\kingdee\Regpermresidence::find()->all(), 'FID', 'FNAME_L2')) ?>
                            </div>
                            <div class="form-group">
                                <?= $form->field($model, 'FIDCARDADDRESS')->textInput() ?>
                            </div>
                            <div class="form-group">
                                <?= $form->field($model, 'FFULLNAMEPINGYIN')->textInput() ?>
                            </div>
                            <div class="form-group">
                                <?= $form->field($model, 'FSIMPLENAMEPINGYIN')->textInput() ?>
                            </div>
                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer">
                            <button type="submit" class="btn btn-primary"><?= Yii::t('app', 'Submit') ?></button>
                        </div>
                    </form>

                    <?php ActiveForm::end() ?>
                </div>
                <!-- /.tab-pane -->
                <div class="tab-pane" id="tab_employee">
                    <div class="box box-widget widget-user-2">
                        <!-- Add the bg color to the header using any of the bg-* classes -->
                        <div class="widget-user-header bg-yellow">
                            <div class="widget-user-image">
                                <img class="img-circle" src="<?= $qywx_user->avatar ?>" alt="<?= Yii::t('app', 'Qywx Avatar') ?>">
                            </div>
                            <!-- /.widget-user-image -->
                            <h3 class="widget-user-username">Nadia Carmichael</h3>
                            <h5 class="widget-user-desc">Lead Developer</h5>
                        </div>
                        <div class="box-footer no-padding">
                            <ul class="nav nav-stacked">
                                <li><a href="#">Projects <span class="pull-right badge bg-blue">31</span></a></li>
                                <li><a href="#">Tasks <span class="pull-right badge bg-aqua">5</span></a></li>
                                <li><a href="#">Completed Projects <span class="pull-right badge bg-green">12</span></a></li>
                                <li><a href="#">Followers <span class="pull-right badge bg-red">842</span></a></li>
                            </ul>
                        </div>
                    </div>
                </div>
                <!-- /.tab-pane -->
                <div class="tab-pane" id="tab_qywx">
                    <?php $form = ActiveForm::begin([
                        'action' => ['/qywx/qywx-user/update'],
                        'method' => 'post',
                    ]); ?>
                    <form role="form">
                        <div class="box-body">
                            <div class="form-group">
                                <?= $form->field($qywx_user, 'userid')->textInput() ?>
                            </div>
                            <div class="form-group">
                                <?= $form->field($qywx_user, 'name')->textInput() ?>
                            </div>
                            <div class="form-group">
                                <?= $form->field($qywx_user, 'number')->textInput() ?>
                            </div>
                            <div class="form-group">
                                <?= $form->field($qywx_user, 'mobile')->textInput() ?>
                            </div>
                            <div class="form-group">
                                <?= $form->field($qywx_user, 'position')->textInput() ?>
                            </div>
                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer">
                            <button type="submit" class="btn btn-primary"><?= Yii::t('app', 'Submit') ?></button>
                        </div>
                    </form>

                    <?php ActiveForm::end() ?>
                </div>
            </div>
        </div>
            <!-- /.tab-content -->
    </div>

</div>
